<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">

    <bean id="reindexJob" class="org.encuestame.core.cron.ReIndexJob">
        <property name="indexRebuilder" ref="indexRebuilder"/>
    </bean>

    <bean id="indexRebuilder" class="org.encuestame.core.cron.IndexRebuilder"/>

    <bean id="reindexingInvokingJobDetail" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
        <property name="targetObject" ref="reindexJob"/>
        <property name="targetMethod" value="reindex"/>
        <property name="concurrent">
            <value>false</value>
        </property>
    </bean>

    <bean id="schedulerFactoryBean"
        class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
        <property name="triggers">
            <list>
                 <bean id="cronReindex" class="org.springframework.scheduling.quartz.CronTriggerBean">
                    <property name="jobDetail" ref="reindexingInvokingJobDetail" />
                    <property name="cronExpression" value="0 0/15 * * * ?" />
                    <!-- Every 5 minutes 0 0/5 * * * ? -->
                    <!-- 0 0 12 1/5 * ? Fire at 12pm (noon) every 5 days every month, starting on the first day of the month. -->
                </bean>
            </list>
        </property>
    </bean>

</beans>
